source("plotting.R")
library(tidyverse)


distance_rep = read_csv("../distance_main_effect_data_cutoff_p1.csv")

me = main_effect_rep(distance_rep)
#p = plot_main_effect_rep(me,"Effect of relative distance on voting\n(in percentage points)")

#save_plot("figures_for_paper/a9_a.pdf", 
#          p, base_height = 14, base_asp = 1.5,device = cairo_pdf)

p = plot_main_effect_rep_default(me,"Effect of relative distance on voting\n(in percentage points)")

save_plot("figures_for_replication/a9_a.pdf", 
          p, base_height = 14, base_asp = 1.5,device = cairo_pdf)

distance_rep = read_csv("../distance_main_effect_data_cutoff_p5.csv")

me = main_effect_rep(distance_rep)
#p = plot_main_effect_rep(me,"Effect of relative distance on voting\n(in percentage points)")


#save_plot("figures_for_paper/a9_b.pdf", 
#          p, base_height = 14, base_asp = 1.5,device = cairo_pdf)

p = plot_main_effect_rep_default(me,"Effect of relative distance on voting\n(in percentage points)")


save_plot("figures_for_replication/a9_b.pdf", 
          p, base_height = 14, base_asp = 1.5,device = cairo_pdf)

shock_rep = read_csv("../shock_main_effect_data_cutoff_p1.csv")

me = main_effect_rep(shock_rep)
#p = plot_main_effect_rep(me,"Effect of shock on voting\n(in percentage points)")


#save_plot("figures_for_paper/a9_c.pdf", 
 #         p, base_height = 14, base_asp = 1.5,device = cairo_pdf)

p = plot_main_effect_rep_default(me,"Effect of shock on voting\n(in percentage points)")


save_plot("figures_for_replication/a9_c.pdf", 
          p, base_height = 14, base_asp = 1.5,device = cairo_pdf)

shock_rep = read_csv("../shock_main_effect_data_cutoff_p5.csv")

me = main_effect_rep(shock_rep)
#p = plot_main_effect_rep(me,"Effect of shock on voting\n(in percentage points)")


#save_plot("figures_for_paper/a9_d.pdf", 
#          p, base_height = 14, base_asp = 1.5,device = cairo_pdf)

p = plot_main_effect_rep_default(me,"Effect of shock on voting\n(in percentage points)")


save_plot("figures_for_replication/a9_d.pdf", 
          p, base_height = 14, base_asp = 1.5,device = cairo_pdf)
